package com.orange.util.texturepack;

import com.orange.opengl.texture.ITexture;
import com.orange.opengl.texture.region.ITextureRegion;
import com.orange.opengl.texture.region.TextureRegion;

/**
 * 
 * 
 * 
 * @author  
 * @since 16:28:48 - 15.08.2011
 */
public class TexturePackTextureRegion extends TextureRegion implements ITexturePackTextureRegion{
	// ===========================================================
	// Constants
	// ===========================================================

	// ===========================================================
	// Fields
	// ===========================================================

	private final int mID;
	private final String mSource;
	private final boolean mTrimmed;
	private final float mSourceX;
	private final float mSourceY;
	private final float mSourceWidth;
	private final float mSourceHeight;

	// ===========================================================
	// Constructors
	// ===========================================================
	
	public TexturePackTextureRegion(ITextureRegion pTextureRegion){
		this(pTextureRegion.getTexture(), pTextureRegion.getTextureX(), pTextureRegion.getTextureY(), pTextureRegion.getWidth(), pTextureRegion.getHeight(), 0, "", pTextureRegion.isRotated(), false, 0.0f, 0.0f, pTextureRegion.getWidth(), pTextureRegion.getHeight());
	}

	public TexturePackTextureRegion(final ITexture pTexture, final float pX, final float pY, final float pWidth, final float pHeight, final int pID, final String pSource, final boolean pRotated, final boolean pTrimmed, final float pSourceX,
			final float pSourceY, final float pSourceWidth, final float pSourceHeight) {
		super(pTexture, pX, pY, pWidth, pHeight, pRotated);

		this.mID = pID;
		this.mSource = pSource;
		this.mTrimmed = pTrimmed;
		this.mSourceX = pSourceX;
		this.mSourceY = pSourceY;
		this.mSourceWidth = pSourceWidth;
		this.mSourceHeight = pSourceHeight;
	}

	// ===========================================================
	// Getter & Setter
	// ===========================================================

	
	public int getID() {
		return this.mID;
	}

	
	public String getSource() {
		return this.mSource;
	}

	
	public boolean isTrimmed() {
		return this.mTrimmed;
	}

	
	public float getSourceX() {
		return this.mSourceX;
	}

	
	public float getSourceY() {
		return this.mSourceY;
	}

	
	public float getSourceWidth() {
		return this.mSourceWidth;
	}

	
	public float getSourceHeight() {
		return this.mSourceHeight;
	}

	// ===========================================================
	// Methods for/from SuperClass/Interfaces
	// ===========================================================
	
	public TexturePackTextureRegion deepCopy() {
		if (this.mRotated) {
			return new TexturePackTextureRegion(this.mTexture, this.mTextureX, this.mTextureY, this.mTextureWidth, this.mTextureHeight, this.mID, this.mSource, this.mRotated, this.mTrimmed, this.mSourceX, this.mSourceY, this.mSourceWidth, this.mSourceHeight);
		} else {
			return new TexturePackTextureRegion(this.mTexture, this.mTextureX, this.mTextureY, this.mTextureWidth, this.mTextureHeight, this.mID, this.mSource, this.mRotated, this.mTrimmed, this.mSourceX, this.mSourceY, this.mSourceWidth, this.mSourceHeight);
		}
	}
	// ===========================================================
	// Methods
	// ===========================================================

	// ===========================================================
	// Inner and Anonymous Classes
	// ===========================================================
}
